home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-2 / Inter.Net 55-2.iso / Mandrake / mdkinst / usr / bin / perl-install / standalone / draksec < prev    next >
Encoding:
Text File  |  2000-01-12  |  1.9 KB  |  59 lines

  1. #!/usr/bin/perl
  2.  
  3. use lib qw(/usr/lib/libDrakX);
  4.  
  5. use common qw(:system :file);
  6. use interactive;
  7. use mouse;
  8. use c;
  9.  
  10. local $_ = join '', @ARGV;
  11.  
  12. /-h/ and die "usage: draksec [--expert]\n";
  13.  
  14. $::expert = /-expert/ || cat_("/etc/sysconfig/system") =~ /^TYPE="?expert/m; #"
  15. $::isStandalone = 1;
  16.  
  17. my $in = vnew interactive('su');
  18.  
  19. my %m = reverse (my %l = (
  20.   0 => _("Welcome To Crackers"),
  21.   1 => _("Poor"),
  22.   2 => _("Low"),
  23.   3 => _("Medium"),
  24.   4 => _("High"),
  25.   5 => _("Paranoid"),
  26. ));
  27. my %help = (
  28.   0 => _("This level is to be used with care. It makes your system more easy to use,
  29. but very sensitive: it must not be used for a machine connected to others
  30. or to the Internet. There is no password access."),
  31.   1 => _("Password are now enabled, but use as a networked computer is still not recommended."),
  32.   2 => _("Few improvements for this security level, the main one is that there are
  33. more security warnings and checks."),
  34.   3 => _("This is the standard security recommended for a computer that will be used
  35. to connect to the Internet as a client. There are now security checks. "),
  36.   4 => _("With this security level, the use of this system as a server becomes possible.
  37. The security is now high enough to use the system as a server which accept
  38. connections from many clients. "),
  39.   5 => _("We take level 4 features, but now the system is entirely closed.
  40. Security features are at their maximum."),
  41. );
  42.  
  43. delete @l{0,1,5} unless $::expert;
  44. delete @help{0,1,5} unless $::expert;
  45.  
  46. if (my $level = $in->ask_from_list('', _("Choose security level") . "\n\n" . 
  47.                    join('', map { "$l{$_}: $help{$_}\n\n" } keys %l), 
  48.                    [ values %l ], $l{$ENV{SECURE_LEVEL}})) {
  49.     my $w = $in->wait_message('', _("Setting security level"));
  50.     $in->suspend;
  51.  
  52.     $ENV{LILO_PASSWORD} = ''; # make it non interactive
  53.     system("/etc/security/msec/init.sh ". $m{$level});
  54.  
  55.     $in->resume;
  56. }
  57.  
  58. $in->exit(0);
  59.